package cn.itlaobing.web.servlet;

import cn.itlaobing.BusinessException.MyBusinessException;
import cn.itlaobing.entity.ItlbAreas;
import cn.itlaobing.servise.ItlbAreasServise;
import cn.itlaobing.web.annotation.MappingAnnotation;
import org.apache.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 类名: cn.itlaobing.web.servlet
 * 功能:
 * 作者:
 * 日期: 2017/11/14 21:46
 */
@WebServlet("/address/*")
public class AreaServlet extends BaseServlet {

    private Logger log= Logger.getLogger(this.getClass());

    @MappingAnnotation("/area")
    public void area(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ItlbAreasServise ias=new ItlbAreasServise();
        List<ItlbAreas> itlbAreases=null;
        try {
            itlbAreases=ias.addressArea();
        } catch (MyBusinessException e) {
            itlbAreases=null;
            log.debug(e.getMessage());
        }
        request.setAttribute("AREA",itlbAreases);
        request.getRequestDispatcher("/WEB-INF/views/display/detail.jsp").forward(request,response);
    }
}
